Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement Actions around wallet and address commands #1682

Merged
merged 1 commit into from
Jan 25, 2019

Conversation

frrist
Copy link
Member

@frrist frrist commented Jan 23, 2019

closes #1666

Description

This PR implements FAT actions wrappers around the go-filecoin wallet and address commands.

if err := re.Emit(&addressResult{addr.String()}); err != nil {
return err
}
alr.Addresses = append(alr.Addresses, addr.String())
Copy link
Member Author

@frrist frrist Jan 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making an assumption here (and elsewhere in this file) that a node will never have more addresses than we can hold in memory; it makes the test methods nicer.

Copy link
Contributor

@phritz phritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frrist please include accurate pr descriptions for whats in the pr. doesnt have to be long but should be accurate to orient the reader to what is changing.

@@ -38,6 +38,11 @@ type addressResult struct {
Address string
}

// AddressListResult is the result of running the address list command.
type AddressListResult struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more precise to call it what it is, which is addresslsresult

_, err := fmt.Fprintln(w, addr.Address)
return err
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, addrs *AddressListResult) error {
for _, addr := range addrs.Addresses {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i assume the way commands library works is that if you return an error it errors out even if you have written some output to w?

Copy link
Member Author

@frrist frrist Jan 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically. If for some reason we couldn't write to w halfway through addrs.Addresses the error would be returned. This doesn't differ much from the previous behaviour, the iteration was just done elsewhere.

}

// KeyInfoListResult is the resut of running the wallet export command.
type KeyInfoListResult struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then cant you call it what it is, walletexportresult?

@@ -0,0 +1,49 @@
package fat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mentioned before that you should move fat to tools/ at some point, much more appropriate there. test helpers is for free functions and the like

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have heard cases for both sides (keeping it where it is and moving it to tools), will address after completion. Issue here so we don't forget: #1695


if err := f.RunCmdJSONWithStdin(ctx, nil, &alr, "go-filecoin", "wallet", "import", file.FileName()); err != nil {
return nil, err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on other PR #1687 (comment)

@frrist frrist merged commit 302d322 into master Jan 25, 2019
@frrist frrist deleted the feat/fat-actions-wallet branch January 25, 2019 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Actions around wallet and address commands
3 participants